<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>事故日志管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/fleet/accidentInformation/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#accidentDate').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
	        $('#reparationsDate').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
	        $('#closingTime').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="accidentInformation" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
		   <tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right">车牌号：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/fleet/vehicleInformation/data" id="vehicleInformation" name="vehicleInformation.id" value="${accidentInformation.vehicleInformation.id}" labelName="vehicleInformation.license" labelValue="${accidentInformation.vehicleInformation.license}"
										title="选择自有车辆" cssClass="form-control required" fieldLabels="车牌号" fieldKeys="license" searchLabels="车牌号" searchKeys="license" ></sys:gridselect>
					</td>
					<td class="width-15 active"><label class="pull-right">车挂号：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/fleet/vehicleInformation/data" id="cgh" name="cgh.id" value="${accidentInformation.cgh.id}" labelName="cgh.license" labelValue="${accidentInformation.cgh.license}"
										title="选择自有车辆" cssClass="form-control required" fieldLabels="车牌号" fieldKeys="license" searchLabels="车牌号" searchKeys="license" ></sys:gridselect>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">驾驶员：</label></td>
					<td class="width-35">
						<form:input path="driver" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">驾驶证号：</label></td>
					<td class="width-35">
						<form:input path="steerMark" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">事故日期：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='accidentDate'>
			                    <input type='text'  name="accidentDate" class="form-control"  value="<fmt:formatDate value="${accidentInformation.accidentDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
					<td class="width-15 active"><label class="pull-right">事故地点：</label></td>
					<td class="width-35">
						<form:input path="accidentSite" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr><td class="width-15 active"><label class="pull-right">事故类型：</label></td>
					<td class="width-35">
						<form:input path="accidentType" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">事故描述：</label></td>
					<td class="width-35">
						<form:input path="accident" htmlEscape="false"    class="form-control "/>
					</td>


				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">报案人：</label></td>
					<td class="width-35">
						<form:input path="reporter" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">事故责任：</label></td>
					<td class="width-35">
						<form:input path="accidentDuty" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">本车损失：</label></td>
					<td class="width-35">
						<form:input path="oneselfLoss" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">第三者损失：</label></td>
					<td class="width-35">
						<form:input path="thirdPartyLoss" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">直接经济损失：</label></td>
					<td class="width-35">
						<form:input path="economyLoss" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">保险现场人员：</label></td>
					<td class="width-35">
						<form:input path="securityOfficer" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">办案人员电话：</label></td>
					<td class="width-35">
						<form:input path="handlingPhone" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">保险现场人员电话：</label></td>
					<td class="width-35">
						<form:input path="insurerPhome" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">赔款金额：</label></td>
					<td class="width-35">
						<form:input path="amountPaid" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">赔款日期时间：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='reparationsDate'>
			                    <input type='text'  name="reparationsDate" class="form-control"  value="<fmt:formatDate value="${accidentInformation.reparationsDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">结案日期时间：</label></td>
					<td class="width-35">
						<p class="input-group">
						<div class='input-group form_datetime' id='closingTime'>
							<input type='text'  name="closingTime" class="form-control"  value="<fmt:formatDate value="${accidentInformation.closingTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>
						</p>
					</td>
					<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
					<td class="width-35">
						<form:input path="remarks" htmlEscape="false"     class="form-control "/>
					</td>
		  		</tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>